package com.ruoyi.decision.service.impl;

import com.ruoyi.decision.domain.ModelClassification;
import com.ruoyi.decision.mapper.ModelClassificationMapper;
import com.ruoyi.decision.service.IModelClassificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Locale;
import java.util.UUID;

/**
 * 模型分类Service业务层处理
 * 
 * @author zbw
 * @date 2022-07-20
 */
@Service
public class ModelClassificationServiceImpl implements IModelClassificationService 
{
    @Autowired
    private ModelClassificationMapper modelClassificationMapper;

    /**
     * 查询模型分类
     * 
     * @param modelTypeId 模型分类主键
     * @return 模型分类
     */
    @Override
    public ModelClassification selectModelClassificationByModelTypeId(String modelTypeId)
    {
        return modelClassificationMapper.selectModelClassificationByModelTypeId(modelTypeId);
    }

    /**
     * 查询模型分类列表
     * 
     * @param modelClassification 模型分类
     * @return 模型分类
     */
    @Override
    public List<ModelClassification> selectModelClassificationList(ModelClassification modelClassification)
    {
        return modelClassificationMapper.selectModelClassificationList(modelClassification);
    }

    /**
     * 新增模型分类
     * 
     * @param modelClassification 模型分类
     * @return 结果
     */
    @Override
    public int insertModelClassification(ModelClassification modelClassification)
    {
        String modelTypeId = UUID.randomUUID().toString().toLowerCase(Locale.ROOT).replace("-","");
        modelClassification.setModelTypeId(modelTypeId);
        return modelClassificationMapper.insertModelClassification(modelClassification);
    }

    /**
     * 修改模型分类
     * 
     * @param modelClassification 模型分类
     * @return 结果
     */
    @Override
    public int updateModelClassification(ModelClassification modelClassification)
    {
        return modelClassificationMapper.updateModelClassification(modelClassification);
    }

    /**
     * 批量删除模型分类
     * 
     * @param modelTypeIds 需要删除的模型分类主键
     * @return 结果
     */
    @Override
    public int deleteModelClassificationByModelTypeIds(String[] modelTypeIds)
    {
        return modelClassificationMapper.deleteModelClassificationByModelTypeIds(modelTypeIds);
    }

    /**
     * 删除模型分类信息
     * 
     * @param modelTypeId 模型分类主键
     * @return 结果
     */
    @Override
    public int deleteModelClassificationByModelTypeId(String modelTypeId)
    {
        return modelClassificationMapper.deleteModelClassificationByModelTypeId(modelTypeId);
    }
}
